package com.snake.springboot.custom.service.assemble.base;


import com.snake.springboot.custom.api.model.base.CustPointsFreezeModel;
import com.snake.springboot.custom.dao.mybatis.entity.base.CustPointsDO;
import com.snake.springboot.custom.dao.mybatis.entity.base.CustPointsFreezeDO;
import org.snake.common.code.SerialNumberGeneratorFactory;

/**
 * <p>算力冻结组装器
 * 类{@code CustPointsFzAssemble} </br>
 * 创建时间2025/3/7 9:44
 *
 * @author yangxt
 * @see
 */
public class CustPointsFzAssemble {
    public static CustPointsFreezeDO freezeDOAss(CustPointsFreezeModel model, CustPointsDO custPointsDO) {
        CustPointsFreezeDO freezeDO = new CustPointsFreezeDO();
        freezeDO.setFreezeId(SerialNumberGeneratorFactory.buildId4Bean());
        freezeDO.setPoints(custPointsDO.getPoints().subtract(model.getFreezePoints()));
        freezeDO.setCustomId(model.getCustomId());
        freezeDO.setFreezePoints(model.getFreezePoints());
        freezeDO.setParentId(model.getParentId());
        freezeDO.setCustPointsId(custPointsDO.getCustPointsId());
        return freezeDO;
    }
}
